'use strict';
var Schema = require('mongoose').Schema,
    CommonEnum = require('../controllers/Enum.js'),
    Model = require('../../../Base/server/controllers/Model');

var modelField = {
    Code: {
        type: String,
        trim: true,
        Name: '编码',
        IsUnique: true,
        IsEmpty: false        
    },
    Name: {
        type: String,
        Name: '名称',
        IsEmpty: false,
        trim: true
    },
    CycleUnit: {
        type: Number,
        Name: '周期单位',
        IsEmpty: false,
        Enum: CommonEnum.CycleUnit
    },
    CycleAmount: {
        type: Number,
        Name: '周期数量'
    },
    FirstTime: {
        type: Date,
        Name: '首次执行时间',
        IsEmpty: false
    },
    IsMonthEnd: {
        type: Boolean,
        Name: '月末执行'
    },
    EndMode: {
        type: Number,
        Name: '结束方式',
        IsEmpty: false,
        Enum: CommonEnum.EndMode
    },
    EndTime: {
        type: Date,
        Name: '结束时间'
    },
    RepeatTimes: {
        type: Number,
        Name: '重复次数'
    },
    IsSystem: {
        type: Boolean,
        Name: '系统预置'
    }
};

var newModel = new Model(modelField);
newModel.addIndex({Name: 1});
newModel.addIndex({Code: 1});
newModel.create('ScheduleProgram', '调度方案');
